builder: Add GtkBuilderScope
authorBenjamin Otte <otte@redhat.com>
Sat, 30 Nov 2019 00:17:10 +0000 (01:17 +0100)
committerBenjamin Otte <otte@redhat.com>
Thu, 12 Dec 2019 18:39:23 +0000 (19:39 +0100)
commitf8a7f30a0dd1643376f942619603719333a8d6bf
treec57d4d338f6b0d9f64fed0099650b4cb5a484a34
parent1f94028ff77d1bfc8550a7dd9c9623e75a5b9943
builder: Add GtkBuilderScope

GtkBuilderScope is an interface that provides the scope that a builder
instance operates in.
It creates closures and resolves types. Language bindings are meant to
use this interface to customize the behavior of builder files, in
particular when instantiating templates.

A default implementation for C is provided via GtkBuilderCScope (to keep
with the awkward naming that glib uses for closures). It is derivable on
purpose so that languages or extensions that extend C can use it.

The reftest code in fact does derive GtkBuilderCScope for its own scope
implementation that implements looking up symbols in modules.

gtk-widget-factory was updated to use the new GtkBuilderCScope to add
its custom callback symbols.
So it does it different from gtk-demo, which uses the normal way of
exporting symbols for dlsym() and thereby makes the 2 demos test the 2
ways GtkBuilder uses for looking up symbols.
14 files changed:
demos/widget-factory/widget-factory.c
docs/reference/gtk/gtk4-sections.txt
gtk/gtk.h
gtk/gtkbuilder.c
gtk/gtkbuilder.h
gtk/gtkbuilderscope.c [new file with mode: 0644]
gtk/gtkbuilderscope.h [new file with mode: 0644]
gtk/gtkbuilderscopeprivate.h [new file with mode: 0644]
gtk/gtktypes.h
gtk/gtkwidget.c
gtk/gtkwidget.h
gtk/meson.build
testsuite/gtk/defaultvalue.c
testsuite/reftests/reftest-snapshot.c